import datetime
import time

class MSEvent:
    def __init__(self):
        self.msId       = 0     #id into the MSDB.events_data_internal
        self.msType     = 0     #PGSM type or fake for specific standalone cases
        self.objectId   = 0     #MSObject.objectId owner of the event

        self.receiveTime    = datetime.datetime.fromtimestamp(time.time())
        self.generateTime   = self.receiveTime

        self.hasContactId   = False
        self.contactIdFull  = ""
        self.contactIdType  = 0
        self.contactIdCode  = 0
        self.contactIdZone  = 0
        self.contactIdGroup = 0

        self.hasGPS         = False
        self.gpsSpeed       = 0.0
        self.gpsLatitude    = 0.0
        self.gpsLongitude   = 0.0

        self.finalyzedLoad  = False
        self.finalyzedSave  = False

    def __cmp__(self, y):
        if not self.finalyzedLoad and y.finalyzedLoad: return -1
        if self.finalyzedLoad and not y.finalyzedLoad: return 1
        if not self.finalyzedSave and y.finalyzedSave: return -1
        if self.finalyzedSave and not y.finalyzedSave: return 1
    
        if self.generateTime < y.generateTime: return -1
        if self.generateTime > y.generateTime: return 1
        if self.eventId < y.eventId: return -1
        if self.eventId > y.eventId: return 1
        return 0




if __name__ == "__main__":
    import sys
    if len(sys.argv) != 1: print "Usage: %s" % (sys.argv[0])
    
    def case1():
        e = MSEvent()

    case1()
